
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const constantRouterMap = [
    {
        path: '/video-upload',
        meta: { title: 'AI Trailer Generator', cache: true },
        component: (resolve) => require(['@/views/videoUpload'], resolve)
    },
    {
        path: '/generate-script',
        meta: { title: 'AI Script Generator', cache: true },
        component: (resolve) => require(['@/views/generateScript'], resolve)
    }
]

const router = new Router({
    mode: 'history',
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRouterMap
})

router.beforeEach((to, from, next) => {
    if (to.meta && to.meta.title) {
        document.title = to.meta.title + ' - ' + 'AltaAI'
    }
    next()
})

export default router